<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class OrderSecond extends BaseModel
{
    use HasFactory;

    protected $table = 'order_second';
    // 允许批量操作的字段
    protected $fillable = [
        'warehouse_id',
        'goods_shelf_id',
        'order_id',
        'modelid',
        'product_id',
        'model_number_id',
        'specification_id',
        'color_id',
        'is_replenishment',
        'is_stock_up',
        'is_del',
        'num',
        'total_num',
        'created_at',
        'updated_at',
        'finish_id',
        'pid',
        'is_kucun',
        'warehouse_location_id'


    ];

    public function scopeSearch($query,$params)
    {
        return $query;
    }

    public function models(){
        return $this->hasOne(Models::class,'modelid','modelid');
    }

    public function product(){
        return $this->hasOne(Product::class,'id','product_id');
    }

    public function model_number(){
        return $this->hasOne(ModelNumber::class,'id','model_number_id');
    }

    public function specification(){
        return $this->hasOne(Specification::class,'id','specification_id');
    }

    public function color(){
        return $this->hasOne(Color::class,'id','color_id');
    }

    public function order_child(){
        return $this->hasMany(OrderChild::class,'order_second_id','id');
    }




}
